import Vue 			from 'vue'
import App 			from './App'
import router 		from './router'
import VueClipboard from 'vue-clipboard2';
import Vant 		from 'vant';
import util 		from './util.js'
import 'vant/lib/index.css';
Vue.use(Vant);
Vue.use(VueClipboard)

router.beforeEach((to,from,next) => {
	if(util.inBBJ()){
		//嵌入在bbj app中
		if(to.name && !from.name){
			//首次加载当前页面
			next()
		}else{
			//页面之间跳转
			// alert('openUrl')
			util.callHandler('openUrl',{
				url:window.location.origin+'/otc/index.html#'+to.fullPath,
				title:to.query.title || 'OTC',
				needLogin:true,
				popVC:to.query.death == 1?true:false,		//跳转的时候是否干掉当前页面
				hiddenNav:to.query.hiddenNav?false:true,	//是否全屏
			},res => {
				console.log(res)
			})
		}
	}else{
		//普通浏览器或mykey中
		next();
	}
})

new Vue({
	el: '#bbj',
	router,
	components: { App },
	template: '<App/>'
})
